package com.zzk.lanouhn.myapplication1.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zzk.lanouhn.myapplication1.R;
import com.zzk.lanouhn.myapplication1.modles.FindDetailsModle;

/**
 * 无用的适配器 就是不删
 * Created by lanouhn on 16/9/7.
 */
public class FindDetailsCaiDanWeizhiAdapter extends RecyclerView.Adapter<FindDetailsCaiDanWeizhiAdapter.MyWeiZhiHolder> {

    private Context context;
    private FindDetailsModle.TripDaysBean modle;

    public FindDetailsCaiDanWeizhiAdapter(Context context, FindDetailsModle.TripDaysBean modle) {
        this.context = context;
        this.modle = modle;
    }

    @Override
    public MyWeiZhiHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(context).inflate(R.layout.item_find_details_caidan_weizhi,null);
        MyWeiZhiHolder holder=new MyWeiZhiHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MyWeiZhiHolder holder, int position) {

        if (modle.getNodes().get(position).getEntry_name()==null){
            holder.ll.setVisibility(View.GONE);
        }else {
            holder.ll.setVisibility(View.VISIBLE);
            holder.weizhi.setText(modle.getNodes().get(position).getEntry_name()+"");
        }

    }

    @Override
    public int getItemCount() {
        return modle.getNodes().size();
    }

    public class MyWeiZhiHolder extends RecyclerView.ViewHolder{

        private TextView weizhi;
        private LinearLayout ll;

        public MyWeiZhiHolder(View itemView) {
            super(itemView);

            weizhi= (TextView) itemView.findViewById(R.id.item_find_details_caidan_weizhi);
            ll= (LinearLayout) itemView.findViewById(R.id.item_find_details_caidan_weizhi_ll);
        }
    }
}
